﻿namespace _02.BankExersice.Accounts
{
    using System;
    using _02.BankExersice.Customers;

    public class Mortage : Account
    {
        public Mortage(Customer customer)
            : base(customer)
        {
        }

        public Mortage(Customer customer, decimal interestRate, decimal balance)
            : base(customer, interestRate, balance)
        {
        }

        public override decimal CalculateInterestAmount(int numberOfMonths)
        {
            if (numberOfMonths <= 6 && this.Customer is IndividualCustomer)
            {
                return 0;
            }
            else if (numberOfMonths <= 12 && this.Customer is CompanyCustomer)
            {
                return base.CalculateInterestAmount(numberOfMonths) / 2;
            }
            else
            {
                return base.CalculateInterestAmount(numberOfMonths);
            }
        }
    }
}
